package org.zfes.snowier.cloud.zbss.cms.router.service.site;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.site.model.CmsSiteTxt;
import org.zfes.snowier.cloud.zbss.cms.site.service.ICmsSiteTxtService;
@Controller 
@RequestMapping("/cms/site/cmsSiteTxt")
public class CmsSiteTxtController extends BaseController {

	
	@Autowired
	private ICmsSiteTxtService cmsSiteTxtService;
	
	@RequiresPermissions(value="cmsSiteTxt:loadCmsSiteTxtDataSet",desc="站点文本列表")
    @RequestMapping(value="/loadCmsSiteTxtDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteTxtDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsSiteTxtService.loadCmsSiteTxtDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsSiteTxt:createCmsSiteTxt",desc="站点文本添加")
    @RequestMapping(value="/createCmsSiteTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsSiteTxt(CmsSiteTxt cmsSiteTxt){
		cmsSiteTxtService.createCmsSiteTxt(cmsSiteTxt);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteTxt:loadCmsSiteTxt",desc="站点文本加载")
    @RequestMapping(value="/loadCmsSiteTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteTxt(Long id){
		Optional<CmsSiteTxt> ops = cmsSiteTxtService.loadCmsSiteTxtById(id);
		return ajaxQuery("cmsSiteTxt",ops);
    }
	
	@RequiresPermissions(value="cmsSiteTxt:updateCmsSiteTxt",desc="站点文本更新")
    @RequestMapping(value="/updateCmsSiteTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsSiteTxt(CmsSiteTxt cmsSiteTxt){
		cmsSiteTxtService.updateCmsSiteTxt(cmsSiteTxt);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteTxt:deletCmsSiteTxt",desc="站点文本删除")
    @RequestMapping(value="/deleteCmsSiteTxt", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsSiteTxt(Long id){
		cmsSiteTxtService.deleteCmsSiteTxt(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}